/*
*编写程序来创建有10个元素的vector对象。用迭代器把每个元素的值改为当前值得2倍
*/
#include<iostream>
#include<vector>
using namespace std;

int main()
{
	vector<int> ivec;
	int iVal;
	cout << "请输入10个整数：";

	//输入
	while(cin >> iVal)
	{
		ivec.push_back(iVal);
		if(ivec.size() != 10)
		{
			cout << "vector对象的元素不为10，程序终止！" << endl;
			system("pause");
			return 0;
		}
	}
	
	//用迭代器将每个元素值改为当前值的2倍
	for(vector<int>::iterator iter = ivec.begin();iter != ivec.end();iter++)
	{
		*iter *= 2;
	}

	//遍历输出
	for(vector<int>::iterator iter = ivec.begin();iter != ivec.end();iter++)
	{
		cout << *iter << " ";
	}

	cout << endl;
	system("pause");
	return 0;
}